package test.runtime;

import service.network.NetworkManageService;
import materials.network.AbstractNetworkCreation;
import materials.network.NetworkInterface;
import materials.network.NeuronalNetwork;
import materials.neurons.Neurons;

public class RechenViehNetz extends AbstractNetworkCreation{

	
	public RechenViehNetz(){
		createNet();
	}

	private void createNet() {
		NetworkInterface ni = new NeuronalNetwork();
		NetworkManageService nms = new NetworkManageService(ni);
		
		nms.raiseLayer();
		nms.raiseLayer();
		nms.raiseLayer();
		
		nms.addNeuronToNetwork(1, "a1", Neurons.Linear);
		nms.addNeuronToNetwork(1, "a2", Neurons.Linear);
		
		
		nms.addNeuronToNetwork(2, "b1", Neurons.Linear);
		nms.addNeuronToNetwork(2, "b2", Neurons.Linear);
		nms.addNeuronToNetwork(2, "b3", Neurons.Linear);
		nms.addNeuronToNetwork(2, "b4", Neurons.Linear);
		
		nms.addNeuronToNetwork(3, "c1", Neurons.Linear);
		nms.addNeuronToNetwork(3, "c2", Neurons.Linear);
		
		for(int i = 1; i < 3; i++){
			for(int j = 1; j < 5; j++){
				nms.connectTwoNeurons(1, "a"+i, "b"+j);
				nms.setWeightOfTwoNeurons(1, "a"+i, "b"+j, (Math.random() -0.5));
			}	
		}
		
		
		for(int i = 1; i < 5; i++){
			for(int j = 1; j < 3; j++){
				nms.connectTwoNeurons(2, "b"+i, "c"+j);
				nms.setWeightOfTwoNeurons(2, "b"+i, "c"+j, (Math.random() -0.5));
			}	
		}
		
		addNet(ni);
	}
}
